Hi Rafal, #1 It is fairly complex to compute the time for a 3rd order move. There are up to 7 "Trip States" that are 3rd order equations.
state 1 - ramp up acceleration state 2 - constant acceleration state 3 - ramp down acceleration state 4 - constant velocity state 5 - ramp up de-acceleration state 6 - constant de-acceleration state 7 - ramp down de- acceleration
There is an internal function that computes the Trip States called:
void SetupForMove(double From, double To, float MaxVel, CHAN *ch, int CoeffOffset, int NoJerkControlAtStart,
int NoJerkControlAtEnd, int Start)
This will compute
the 7 sets of 3rd order coefficients and the time durations for each Trip into a list of TRIP_COEFF structures at ch->c but not execute the motion.
#2
Yes if you set the Accel and Jerk very large you will get essentially constant velocity. You may have problems with numbers of 1e99. But 1e12 should work.
#3
There is 1/8th of a microstep of hysteresis built into the Step/Dir Generator. Depending on the fractional position of where you are you may need slightly more than 1 microstep of motion before a pulse is generated after a reversal in direction.
HTH Regards TK
| Group: DynoMotion |
Message: 6330 |
From: rafjawo |
Date: 12/28/2012 |
| Subject: Re: Calculate time of movement |
Hi Tom,
thanks for your answer,
But to clarify
#1
Can I you explain me parameters of this function?
From ->start position
To ->end position
MaxVel ->max velocity
CHAN *ch ->pointer to channel (ch0,ch1...)
CoeffOffset ->?????
NoJerkControlAtStart ->?????
NoJerkControlAtEnd ->?????
Start ->?????
Can I call this function in my program?
Should I calculate sum of ch0->c[n].t n(0..6) to calculate time of movement?
#2
Clear
#3
How to avoid this? I have to be sure that count of pulses are generate correctly.
Can this happen with other amount of pulses? I use it for engraving So its very important to have exactly count of pulses on output. My move is about 5 to 15. up/down. should I zeroing axis before move? then start:
MoveRelAtVel (2, i_data [8]+0.1, (3000));
while (! CheckDone (2));
MoveRelAtVel (2-i_data [8]-0.2, (3000));
while (! CheckDone (2));
Zero(2);
Regards
RJ
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Rafal,
>
>
> #1
>
> It is fairly complex to compute the time for a 3rd order move. There are up to 7 "Trip States" that are 3rd order equations.
>
>
> Â Â state 1 - ramp up acceleration
> Â Â state 2 - constant acceleration
> Â Â state 3 - ramp down acceleration
> Â Â state 4 - constant velocity
> Â Â state 5 - ramp up de-acceleration
> Â Â state 6 - constant de-acceleration
> Â Â state 7 - ramp down de- acceleration
>
>
> There is an internal function that computes the Trip States called:
>
> void SetupForMove(double From, double To, float MaxVel, CHAN *ch, int CoeffOffset,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â int NoJerkControlAtStart,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â int NoJerkControlAtEnd,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â int Start)
>
>
> This will compute the 7 sets of 3rd order coefficients and the time durations for each Trip into a list of TRIP_COEFF structures at ch->c but not execute the motion.
>
>
> #2
>
> Yes if you set the Accel and Jerk very large you will get essentially constant velocity. You may have problems with numbers of 1e99. But 1e12 should work.
>
> #3
>
> There is 1/8th of a microstep of hysteresis built into the Step/Dir Generator. Depending on the fractional position of where you are you may need slightly more than 1 microstep of motion before a pulse is generated after a reversal in direction.
>
> HTH
> Regards
> TK
>
>
>
>
>
> ________________________________
> From: rafjawo <raf.jawo@...>
> To: DynoMotion@yahoogroups.com
> Sent: Friday, December 21, 2012 2:56 AM
> Subject: [DynoMotion] Calculate time of movement
>
>
> Â
> Hi all,
> I have a few questions:
> 1st How to estimate the time at which the motion is made.
> System built on a stepper motor. I need to know the time before the move. Movement is initiated in the task, and it looks like this:
>
> ch2-> Vel = 10000;
> ch2-> Accel = 6E8 / / 6E8
> ch2-> Jerk = 6E10;/ / 6E10;
> ....
> .
> MoveRelAtVel (2, i_data [8], (3000));
> while (! CheckDone (2));
>
> MoveRelAtVel (2-i_data [8], (3000));
> while (! CheckDone (2));
>
> I have to predict the execution time of such a movement.
>
> 2nd If I set Accel & Jerk very large e.g. 1e99. Do I receive approximately constant frequency on the output? A fixed number of pulses?
>
> 3rd sometimes when you send a command like:
> moverel2 = 1
> I see no movement. Axis dest looks good (1). The next command causes movement. Unfortunately I do not have an oscilloscope to see if in fact there is no pulse output. But rather, there is no pulse.
>
> Regards
>
> Rafal
>
|
|
| Group: DynoMotion |
Message: 6333 |
From: Tom Kerekes |
Date: 12/28/2012 |
| Subject: Re: Calculate time of movement |
Hi RJ, CoeffOffset is the offset to begin placing the "Trips" into the "c" array. Set to 0 to begin placing in the beginning of the array. NoJerk... Set to false (0) for the normal situation. In some case back to back movements (stop followed by a reversal) are smoother faster without ramping the acceleration to zero between moves, Start = Set to false unless you actually want the move to begin executing Yes you can call this function in your program. Make sure an independent motion using the same "c" array coefficients is not currently in use.
Yes sum those 7 Trip State Times to find the total time of the move.
Regarding #3: I don't fully understand the problem. KFLOP will always command the correct number of pulses for the commanded position with 1/8th step of hysterisis. This solves problems when moving on the exact boundary between two steps. You can think of each "step" having a range. For example Step position 0 has a range from -0.5 to +0.5. So for example moving from 0.4999999 to 0.5000001 and then back to 0.499999
could cause steps forward and backward (with no time between) when there should really be no motion. Dithering on the boundary between steps. So if KFLOP generates a + step output on a movement from 0.4999999 to 0.5000001 a backward motion to 0.375 will be required to generate a - step output. I suppose you could truncate all your positions to integers if you wish.
HTH Regards TK
| Group: DynoMotion |
Message: 6334 |
From: Tom Kerekes |
Date: 12/28/2012 |
| Subject: Re: Calculate time of movement |
Hi RJ, CoeffOffset is the offset to begin placing the "Trips" into the "c" array. Set to 0 to begin placing in the beginning of the array. NoJerk... Set to false (0) for the normal situation. In some case back to back movements (stop followed by a reversal) are smoother faster without ramping the acceleration to zero between moves, Start = Set to false unless you actually want the move to begin executing Yes you can call this function in your program. Make sure an independent motion using the same "c" array coefficients is not currently in use.
Yes sum those 7 Trip State Times to find the total time of the move.
Regarding #3: I don't fully understand the problem. KFLOP will always command the correct number of pulses for the commanded position with 1/8th step of hysterisis. This solves problems when moving on the exact boundary between two steps. You can think of each "step" having a range. For example Step position 0 has a range from -0.5 to +0.5. So for example moving from 0.4999999 to 0.5000001 and then back to 0.499999
could cause steps forward and backward (with no time between) when there should really be no motion. Dithering on the boundary between steps. So if KFLOP generates a + step output on a movement from 0.4999999 to 0.5000001 a backward motion to 0.375 will be required to generate a - step output. I suppose you could truncate all your positions to integers if you wish.
HTH Regards TK
| Group: DynoMotion |
Message: 6336 |
From: rafjawo |
Date: 12/28/2012 |
| Subject: Re: Calculate time of movement |
Hi Tom,
#1
So if I set Start to 1 it will generate a move? can I use it instead any move command?
#3
You wrote:
> > There is 1/8th of a microstep of hysteresis built into the Step/Dir Generator.ÃÂ Depending on the fractional position of where you are you may need slightly more than 1 microstep of motion before a pulse is generated after a reversal in direction.
As I wrote before. When I use command Moverel2=1 in reverse direction i see no move. Some times everything is ok after calling few times: EnableAxisDest(Z,0.0); I always use integer position with stepper motors
Regards
Rafal J.
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi RJ,
>
> CoeffOffset is the offset to begin placing the "Trips" into the "c" array. Set to 0 to begin placing in the beginning of the array.
>
> NoJerk... Set to false (0) for the normal situation. In some case back to back movements (stop followed by a reversal) are smoother faster without ramping the acceleration to zero between moves,
>
> Start = Set to false unless you actually want the move to begin executing
>
>
>
> Yes you can call this function in your program. Make sure an independent motion using the same "c" array coefficients is not currently in use.
>
> Yes sum those 7 Trip State Times to find the total time of the move.
>
> Regarding #3: I don't fully understand the problem. KFLOP will always command the correct number of pulses for the commanded position with 1/8th step of hysterisis. This solves problems when moving on the exact boundary between two steps. You can think of each "step" having a range. For example Step position 0 has a range from -0.5 to +0.5. So for example moving from 0.4999999 to 0.5000001 and then back to 0.499999 could cause steps forward and backward (with no time between) when there should really be no motion. Dithering on the boundary between steps. So if KFLOP generates a + step output on a movement from 0.4999999 to 0.5000001 a backward motion to 0.375 will be required to generate a - step output. I suppose you could truncate all your positions to integers if you wish.
>
> HTH
> Regards
> TK
>
>
>
> ________________________________
> From: rafjawo <raf.jawo@...>
> To: DynoMotion@yahoogroups.com
> Sent: Friday, December 28, 2012 12:07 AM
> Subject: [DynoMotion] Re: Calculate time of movement
>
>
> Â
> Hi Tom,
>
> thanks for your answer,
> But to clarify
> #1
> Can I you explain me parameters of this function?
> From ->start position
> To ->end position
> MaxVel ->max velocity
> CHAN *ch ->pointer to channel (ch0,ch1...)
> CoeffOffset ->?????
> NoJerkControlAtStart ->?????
> NoJerkControlAtEnd ->?????
> Start ->?????
>
> Can I call this function in my program?
> Should I calculate sum of ch0->c[n].t n(0..6) to calculate time of movement?
>
> #2
> Clear
>
> #3
> How to avoid this? I have to be sure that count of pulses are generate correctly.
> Can this happen with other amount of pulses? I use it for engraving So its very important to have exactly count of pulses on output. My move is about 5 to 15. up/down. should I zeroing axis before move? then start:
>
> MoveRelAtVel (2, i_data [8]+0.1, (3000));
> while (! CheckDone (2));
>
> MoveRelAtVel (2-i_data [8]-0.2, (3000));
> while (! CheckDone (2));
> Zero(2);
>
> Regards
>
> RJ
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Rafal,
> >
> >
> > #1
> >
> > It is fairly complex to compute the time for a 3rd order move.ÃÂ There are up to 7 "Trip States" that are 3rd order equations.
> >
> >
> > ÃÂ ÃÂ state 1 - ramp up acceleration
> > ÃÂ ÃÂ state 2 - constant acceleration
> > ÃÂ ÃÂ state 3 - ramp down acceleration
> > ÃÂ ÃÂ state 4 - constant velocity
> > ÃÂ ÃÂ state 5 - ramp up de-acceleration
> > ÃÂ ÃÂ state 6 - constant de-acceleration
> > ÃÂ ÃÂ state 7 - ramp down de- acceleration
> >
> >
> > There is an internal function that computes the Trip States called:
> >
> > void SetupForMove(double From, double To, float MaxVel, CHAN *ch, int CoeffOffset,
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ int NoJerkControlAtStart,
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ int NoJerkControlAtEnd,
> > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ int Start)
> >
> >
> > This will compute the 7 sets of 3rd order coefficients and the time durations for each Trip into a list of TRIP_COEFF structures at ch->c but not execute the motion.
> >
> >
> > #2
> >
> > Yes if you set the Accel and Jerk very large you will get essentially constant velocity.ÃÂ You may have problems with numbers of 1e99.ÃÂ But 1e12 should work.
> >
> > #3
> >
> > There is 1/8th of a microstep of hysteresis built into the Step/Dir Generator.ÃÂ Depending on the fractional position of where you are you may need slightly more than 1 microstep of motion before a pulse is generated after a reversal in direction.
> >
> > HTH
> > Regards
> > TK
> >
> >
> >
> >
> >
> > ________________________________
> > From: rafjawo <raf.jawo@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Friday, December 21, 2012 2:56 AM
> > Subject: [DynoMotion] Calculate time of movement
> >
> >
> > ÃÂ
> > Hi all,
> > I have a few questions:
> > 1st How to estimate the time at which the motion is made.
> > System built on a stepper motor. I need to know the time before the move. Movement is initiated in the task, and it looks like this:
> >
> > ch2-> Vel = 10000;
> > ch2-> Accel = 6E8 / / 6E8
> > ch2-> Jerk = 6E10;/ / 6E10;
> > ....
> > .
> > MoveRelAtVel (2, i_data [8], (3000));
> > while (! CheckDone (2));
> >
> > MoveRelAtVel (2-i_data [8], (3000));
> > while (! CheckDone (2));
> >
> > I have to predict the execution time of such a movement.
> >
> > 2nd If I set Accel & Jerk very large e.g. 1e99. Do I receive approximately constant frequency on the output? A fixed number of pulses?
> >
> > 3rd sometimes when you send a command like:
> > moverel2 = 1
> > I see no movement. Axis dest looks good (1). The next command causes movement. Unfortunately I do not have an oscilloscope to see if in fact there is no pulse output. But rather, there is no pulse.
> >
> > Regards
> >
> > Rafal
> >
>
|
|
| Group: DynoMotion |
Message: 6339 |
From: Tom Kerekes |
Date: 12/29/2012 |
| Subject: Re: Calculate time of movement |
Hi Rafel, #1 - Yes. But I thought you wanted to know the time before the move? If you are ok with starting the move then you can use the normal Move() command (which will call the SetupForMove() function). #3 - You are correct. After looking into it I realized that the exact transition points where steps occur is indeterminate (although forever after consistant). Here is a workaround (add this where you enable your Axis). #define AXIS 0 // the axis to enable #define STEPGEN (chan[AXIS].OutputChan0 & 7) // determines which base Step/Dir Generator it uses extern double ActualStepPos[NSTEPDIR]; EnableAxisDest(AXIS,0);
ActualStepPos[STEPGEN]=(FPGA(STEP_POSITION_ADD0+STEPGEN*2)&0x7f)/128.0-0.5; This will guarantee that the step transition points are always half way between integer positions. HTH Regards TK
From: rafjawo <raf.jawo@...> To: DynoMotion@yahoogroups.com Sent: Friday, December 28,
2012 12:20 PM Subject: [DynoMotion] Re: Calculate time of movement
Hi Tom,
#1
So if I set Start to 1 it will generate a move? can I use it instead any move command?
#3
You wrote:
> > There is 1/8th of a microstep of hysteresis built into the Step/Dir Generator. Depending on the fractional position of where you are you may need slightly more than 1 microstep of motion before a pulse is generated after a reversal in direction.
As I wrote before. When I use command Moverel2=1 in reverse direction i see no move. Some times everything is ok after calling few times: EnableAxisDest(Z,0.0); I always use integer position with stepper motors
Regards
Rafal J.
--- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi RJ,
>
> CoeffOffset is the offset to begin placing the "Trips" into the "c" array. Set to 0 to begin placing in the beginning of the array.
>
> NoJerk... Set to false (0) for the normal situation. In some case back to back movements (stop followed by a reversal) are smoother faster without ramping the acceleration to zero between moves,
>
> Start = Set to false unless you actually want the move to begin executing
>
>
>
> Yes you can call this function in your program. Make sure an independent motion using the same "c" array coefficients is not currently in use.
>
> Yes sum those 7 Trip State Times to find the total time of the move.
>
> Regarding #3: I don't fully understand the problem. KFLOP will always command the correct number of pulses for the commanded position with 1/8th step of hysterisis. This solves problems when moving on the exact boundary between two steps. You can think of each "step" having a range. For example Step position 0 has a range from -0.5 to +0.5. So for example moving from 0.4999999 to 0.5000001 and then back to 0.499999 could cause steps forward and backward (with no time between) when there should really be no motion. Dithering on the boundary between steps. So if KFLOP generates a + step output on a movement from 0.4999999 to 0.5000001 a backward motion to 0.375 will be required to generate a - step output. I suppose you could truncate all your positions to integers if you wish.
>
> HTH
> Regards
> TK
>
>
>
> ________________________________
> From: rafjawo <raf.jawo@...>
> To: mailto:DynoMotion%40yahoogroups.com
> Sent: Friday, December 28, 2012 12:07 AM
> Subject: [DynoMotion] Re: Calculate time of movement
>
>
> Â
> Hi Tom,
>
> thanks for your answer,
> But to clarify
> #1
> Can I you explain me parameters of this function?
> From ->start position
> To ->end position
> MaxVel ->max velocity
> CHAN *ch ->pointer to channel (ch0,ch1...)
> CoeffOffset ->?????
> NoJerkControlAtStart ->?????
> NoJerkControlAtEnd ->?????
> Start ->?????
>
> Can I call this function in my program?
> Should I calculate sum of ch0->c[n].t n(0..6) to calculate time of movement?
>
> #2
> Clear
>
> #3
> How to avoid this? I have to be sure that count of pulses are generate correctly.
> Can this happen with other amount of pulses? I use it for engraving So its very important to have exactly count of pulses on output. My move is about 5 to 15. up/down. should I zeroing axis before move? then start:
>
> MoveRelAtVel (2, i_data [8]+0.1, (3000));
> while (! CheckDone (2));
>
> MoveRelAtVel (2-i_data [8]-0.2, (3000));
> while (! CheckDone (2));
> Zero(2);
>
> Regards
>
> RJ
>
> --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Rafal,
> >
> >
> > #1
> >
> > It is fairly complex to compute the time for a 3rd order move. There are up to 7 "Trip States" that are 3rd order equations.
> >
> >
> >   state 1 - ramp up acceleration
> >   state 2 - constant acceleration
> >   state 3 - ramp down acceleration
> >   state 4 - constant velocity
> >   state 5 - ramp up de-acceleration
> >   state 6 - constant de-acceleration
> >   state 7 - ramp down de- acceleration
> >
> >
> > There is an internal function that computes the Trip States called:
> >
> > void SetupForMove(double From, double To, float MaxVel, CHAN *ch, int CoeffOffset,
> >                                         int NoJerkControlAtStart,
> >                                                  int NoJerkControlAtEnd,
> >                                                  int Start)
> >
> >
> > This will compute the 7 sets of 3rd order coefficients and the time durations for each Trip into a list of TRIP_COEFF structures at ch->c but not execute the motion.
> >
> >
> > #2
> >
> > Yes if you set the Accel and Jerk very large you will get essentially constant velocity. You may have problems with numbers of 1e99. But 1e12 should work.
> >
> > #3
> >
> > There is 1/8th of a microstep of hysteresis built into the Step/Dir Generator. Depending on the fractional position of where you are you may need slightly more than 1 microstep of motion before a pulse is generated after a reversal in direction.
> >
> > HTH
> > Regards
> > TK
> >
> >
> >
> >
> >
> > ________________________________
> > From: rafjawo <raf.jawo@>
> > To: mailto:DynoMotion%40yahoogroups.com
> > Sent: Friday, December 21, 2012 2:56 AM
> > Subject: [DynoMotion] Calculate time of movement
> >
> >
> > ÂÂ
> > Hi all,
> > I have a few questions:
> > 1st How to estimate the time at which the motion is made​​.
> > System built on a stepper motor. I need to know the time before the move. Movement is initiated in the task, and it looks like this:
> >
> > ch2-> Vel = 10000;
> > ch2-> Accel = 6E8 / / 6E8
> > ch2-> Jerk = 6E10;/ / 6E10;
> > ....
> > .
> > MoveRelAtVel (2, i_data [8], (3000));
> > while (! CheckDone (2));
> >
> > MoveRelAtVel (2-i_data [8], (3000));
> > while (! CheckDone (2));
> >
> > I have to predict the execution time of such a movement.
> >
> > 2nd If I set Accel & Jerk very large e.g. 1e99. Do I receive approximately constant frequency on the output? A fixed number of pulses?
> >
> > 3rd sometimes when you send a command like:
> > moverel2 = 1
> > I see no movement. Axis dest looks good (1). The next command causes movement. Unfortunately I do not have an oscilloscope to see if in fact there is no pulse output. But rather, there is no pulse.
> >
> > Regards
> >
> > Rafal
> >
>
|
|
| Group: DynoMotion |
Message: 6347 |
From: rafjawo |
Date: 12/29/2012 |
| Subject: Re: Calculate time of movement |
Hi Tom,
Thanks for your help.
#3 solved.
#1 I have done some tests. Here is my short program:
double myTimer;
double myTimer2;
unsigned int *i_data;
i_data=gather_buffer;
myTimer=Time_sec();
SetupForMove(0, i_data[8], i_data[9], ch2, 0,1,1,1);
myTimer2=(ch2->c[0].t+ch2->c[1].t+ch2->c[2].t+ch2->c[3].t+ch2->c[4].t+ch2->c[5].t+ch2->c[6].t)*1000000;
while(!CheckDone(2));
myTimer=Time_sec()-myTimer;
myTimer=myTimer*1000000.0;
i_data[100]=(int)myTimer;
i_data[101]=(int)myTimer2;
i_data[102]=(int)(myTimer-myTimer2);
i_data[103]=(int)(ch2->c[0].t*1000000);
i_data[104]=(int)(ch2->c[1].t*1000000);
i_data[105]=(int)(ch2->c[2].t*1000000);
i_data[106]=(int)(ch2->c[3].t*1000000);
i_data[107]=(int)(ch2->c[4].t*1000000);
i_data[108]=(int)(ch2->c[5].t*1000000);
i_data[109]=(int)(ch2->c[6].t*1000000);
I can see difference between myTimer & myTimer2. it is about 300 to 470us. Its changing when I change speed or length of move. Its constant with constant parameter
For example:
-----------------------------
GetGatherdec8;GetGatherdec9;
10
4000
KFLOP 4.29
Ready
GetGatherdec100;GetGatherdec101;GetGatherdec102;
3239
3016
223
-----------------------------------
GetGatherdec8;GetGatherdec9;
10
6000
KFLOP 4.29
Ready
GetGatherdec100;GetGatherdec101;GetGatherdec102;
2699
2299
400
-----------------------------------
GetGatherdec8;GetGatherdec9;
15
500
KFLOP 4.29
Ready
GetGatherdec100;GetGatherdec101;GetGatherdec102;
30509
30182
326
---------------------------
I'm not sure where is delay. Before move? or CheckDone? Time_sec()?
I'm using only one user task
Regards
Rafal J
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Rafel,
> #1 - Yes. But I thought you wanted to know the time before the move? If you are ok with starting the move then you can use the normal Move() command (which will call the SetupForMove() function).
> #3 - You are correct. After looking into it I realized that the exact transition points where steps occur is indeterminate (although forever after consistant). Here is a workaround (add this where you enable your Axis).
> #define AXIS 0 // the axis to enable
> #define STEPGEN (chan[AXIS].OutputChan0 & 7) // determines which base Step/Dir Generator it uses
> extern double ActualStepPos[NSTEPDIR];
> EnableAxisDest(AXIS,0);
> ActualStepPos[STEPGEN]=(FPGA(STEP_POSITION_ADD0+STEPGEN*2)&0x7f)/128.0-0.5;
>
> This will guarantee that the step transition points are always half way between integer positions.
> HTH
> Regards
> TK
>
>
>
> ________________________________
> From: rafjawo <raf.jawo@...>
> To: DynoMotion@yahoogroups.com
> Sent: Friday, December 28, 2012 12:20 PM
> Subject: [DynoMotion] Re: Calculate time of movement
>
>
> Â
>
> Hi Tom,
> #1
> So if I set Start to 1 it will generate a move? can I use it instead any move command?
>
> #3
> You wrote:
> > > There is 1/8th of a microstep of hysteresis built into the Step/Dir Generator.Ãâà Depending on the fractional position of where you are you may need slightly more than 1 microstep of motion before a pulse is generated after a reversal in direction.
>
> As I wrote before. When I use command Moverel2=1 in reverse direction i see no move. Some times everything is ok after calling few times: EnableAxisDest(Z,0.0); I always use integer position with stepper motors
>
> Regards
> Rafal J.
>
> --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi RJ,
> >
> > CoeffOffset is the offset to begin placing the "Trips" into the "c" array.ÃÂ Set to 0 to begin placing in the beginning of the array.
> >
> > NoJerk...ÃÂ Set to false (0) for the normal situation.ÃÂ In some case back to back movements (stop followed by a reversal) are smoother faster without ramping the acceleration to zero between moves,
> >
> > Start = Set to false unless you actually want the move to begin executing
> >
> >
> >
> > Yes you can call this function in your program.ÃÂ Make sure an independent motion using the same "c" array coefficients is not currently in use.
> >
> > Yes sum those 7 Trip State Times to find the total time of the move.
> >
> > Regarding #3: I don't fully understand the problem.ÃÂ KFLOP will always command the correct number of pulses for the commanded position with 1/8th step of hysterisis.ÃÂ This solves problems when moving on the exact boundary between two steps.ÃÂ You can think of each "step" having a range.ÃÂ For example Step position 0 has a range from -0.5 to +0.5.ÃÂ So for example moving from 0.4999999 to 0.5000001 and then back to 0.499999 could cause steps forward and backward (with no time between) when there should really be no motion.ÃÂ Dithering on the boundary between steps.ÃÂ So if KFLOP generates a + step output on a movement from 0.4999999 to 0.5000001 a backward motion to 0.375 will be required to generate a - step output.ÃÂ I suppose you could truncate all your positions to integers if you wish.
> >
> > HTH
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: rafjawo <raf.jawo@>
> > To: mailto:DynoMotion%40yahoogroups.com
> > Sent: Friday, December 28, 2012 12:07 AM
> > Subject: [DynoMotion] Re: Calculate time of movement
> >
> >
> > ÃÂ
> > Hi Tom,
> >
> > thanks for your answer,
> > But to clarify
> > #1
> > Can I you explain me parameters of this function?
> > From ->start position
> > To ->end position
> > MaxVel ->max velocity
> > CHAN *ch ->pointer to channel (ch0,ch1...)
> > CoeffOffset ->?????
> > NoJerkControlAtStart ->?????
> > NoJerkControlAtEnd ->?????
> > Start ->?????
> >
> > Can I call this function in my program?
> > Should I calculate sum of ch0->c[n].t n(0..6) to calculate time of movement?
> >
> > #2
> > Clear
> >
> > #3
> > How to avoid this? I have to be sure that count of pulses are generate correctly.
> > Can this happen with other amount of pulses? I use it for engraving So its very important to have exactly count of pulses on output. My move is about 5 to 15. up/down. should I zeroing axis before move? then start:
> >
> > MoveRelAtVel (2, i_data [8]+0.1, (3000));
> > while (! CheckDone (2));
> >
> > MoveRelAtVel (2-i_data [8]-0.2, (3000));
> > while (! CheckDone (2));
> > Zero(2);
> >
> > Regards
> >
> > RJ
> >
> > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Rafal,
> > >
> > >
> > > #1
> > >
> > > It is fairly complex to compute the time for a 3rd order move.ÃâàThere are up to 7 "Trip States" that are 3rd order equations.
> > >
> > >
> > > ÃâàÃâàstate 1 - ramp up acceleration
> > > ÃâàÃâàstate 2 - constant acceleration
> > > ÃâàÃâàstate 3 - ramp down acceleration
> > > ÃâàÃâàstate 4 - constant velocity
> > > ÃâàÃâàstate 5 - ramp up de-acceleration
> > > ÃâàÃâàstate 6 - constant de-acceleration
> > > ÃâàÃâàstate 7 - ramp down de- acceleration
> > >
> > >
> > > There is an internal function that computes the Trip States called:
> > >
> > > void SetupForMove(double From, double To, float MaxVel, CHAN *ch, int CoeffOffset,
> > > ÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàint NoJerkControlAtStart,
> > > ÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàint NoJerkControlAtEnd,
> > > ÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàÃâàint Start)
> > >
> > >
> > > This will compute the 7 sets of 3rd order coefficients and the time durations for each Trip into a list of TRIP_COEFF structures at ch->c but not execute the motion.
> > >
> > >
> > > #2
> > >
> > > Yes if you set the Accel and Jerk very large you will get essentially constant velocity.ÃâàYou may have problems with numbers of 1e99.ÃâàBut 1e12 should work.
> > >
> > > #3
> > >
> > > There is 1/8th of a microstep of hysteresis built into the Step/Dir Generator.ÃâàDepending on the fractional position of where you are you may need slightly more than 1 microstep of motion before a pulse is generated after a reversal in direction.
> > >
> > > HTH
> > > Regards
> > > TK
> > >
> > >
> > >
> > >
> > >
> > > ________________________________
> > > From: rafjawo <raf.jawo@>
> > > To: mailto:DynoMotion%40yahoogroups.com
> > > Sent: Friday, December 21, 2012 2:56 AM
> > > Subject: [DynoMotion] Calculate time of movement
> > >
> > >
> > > ÃâÃÂ
> > > Hi all,
> > > I have a few questions:
> > > 1st How to estimate the time at which the motion is made.
> > > System built on a stepper motor. I need to know the time before the move. Movement is initiated in the task, and it looks like this:
> > >
> > > ch2-> Vel = 10000;
> > > ch2-> Accel = 6E8 / / 6E8
> > > ch2-> Jerk = 6E10;/ / 6E10;
> > > ....
> > > .
> > > MoveRelAtVel (2, i_data [8], (3000));
> > > while (! CheckDone (2));
> > >
> > > MoveRelAtVel (2-i_data [8], (3000));
> > > while (! CheckDone (2));
> > >
> > > I have to predict the execution time of such a movement.
> > >
> > > 2nd If I set Accel & Jerk very large e.g. 1e99. Do I receive approximately constant frequency on the output? A fixed number of pulses?
> > >
> > > 3rd sometimes when you send a command like:
> > > moverel2 = 1
> > > I see no movement. Axis dest looks good (1). The next command causes movement. Unfortunately I do not have an oscilloscope to see if in fact there is no pulse output. But rather, there is no pulse.
> > >
> > > Regards
> > >
> > > Rafal
> > >
> >
>
|
|
| Group: DynoMotion |
Message: 6348 |
From: Tom Kerekes |
Date: 12/29/2012 |
| Subject: Re: Calculate time of movement |
Hi Rafel, I think several hundred microseconds is within the expected uncertainty. The Servo Sample Rate that generates the trajectory is 90us. User Threads only execute every 180us. The SetupForMove involves a lot of calculations to compute the 7 3rd-order polynomials. All these add time and uncertainty to get the move started and to detect when it completes. The motion itself should be very accurate once started and equal to the computed times. If you nee more accurate times between moves and such you may need to use the Coordinated Motion Buffer and queue all the moves. HTH Regards TK
| | | | | | | |